<template>
    <p>这是product页</p>
</template>
<script>
import { onMounted } from 'vue';

export default{
    watch:{
        $route(newVal,oldVal){
            console.log("newVal",newVal);
            console.log("oldVal",oldVal);
            //触发初始化的逻辑
            this.init()
        }
    },
    methods:{
        init(){
            console.log("初始化数据");
            console.log("现在的id是"+this.$route.params.id);
        }
    },
    mounted (){
            console.log("mounted生命周期函数触发了");
            console.log(this.$route);
        },
}
</script>
<style scoped>
</style>